package demo2;

import jdk.nashorn.internal.ir.IdentNode;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

//杨辉三角
public class Test {
    public List<List<Integer>> generate(int numRows){
        List<List<Integer>> ret = new ArrayList<>();
        List<Integer> list = new ArrayList<>();
        list.add(1);
        ret.add(list);
        for (int i = 1; i < numRows ; i++) {
            List<Integer> curRow = new ArrayList<>();
            List<Integer> preRow = ret.get(i-1);
            curRow.add(1);
            for (int j = 1; j < i; j++) {
                int val = preRow.get(j)+preRow.get(j-1);
                curRow.add(val);
            }
            curRow.add(1);
            ret.add(curRow);
        }
        return ret;
    }
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextLine()){
            int num = scanner.nextInt();
            Test yangHui = new Test();
            List<List<Integer>> list = yangHui.generate(num);
            System.out.println(list);
        }

    }
}
